﻿using System;
using System.Windows.Forms;

namespace dazhe
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        double totle = 0;

        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            CashContext cc = new CashContext(comboBox1.SelectedItem.ToString());
            double totleprice = 0;

            string price = this.textBox1.Text;
            string count = this.textBox2.Text;

            totleprice = cc.GetResult(Convert.ToDouble(price) * Convert.ToDouble(count));

            totle = totle + totleprice;
            listView1.Items.Add("单价：" + price + "数量：" + count
                + " " + comboBox1.SelectedItem.ToString() + " 合计："
                + totleprice.ToString()
                );

            this.textBox3.Text = totle.ToString();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.comboBox1.SelectedIndex = 0;
        }
    }
}